#ifndef _LE_AT_COM_H
#define _LE_AT_COM_H

#include <stdint.h>
#include "bt_common.h"

#if CONFIG_APP_AT_CHAR_COM
int ble_at_set_address(u8 *addr);
int ble_at_get_address(u8 *addr);
int ble_at_set_name(u8 *name, u8 len);
int ble_at_get_name(u8 *name);
int ble_at_set_visibility(u8 en);
int ble_at_send_data(u8 *data, u8 len);
int ble_at_send_data_default(u8 *data, u8 len);
int ble_at_set_pair_mode(u8 mode);
int ble_at_disconnect(void);
int ble_at_confirm_gkey(u8 *key_info);
int ble_at_set_adv_data(u8 *data, u8 len);
int ble_at_set_rsp_data(u8 *data, u8 len);
void ble_at_register_event_cbk(void *cbk);
int ble_at_adv_enable(u8 enable);
int ble_at_get_adv_state(void);
int ble_at_set_adv_interval(u16 value);
int ble_at_get_adv_interval(void);
u8 *ble_at_get_adv_data(u8 *len);
u8 *ble_at_get_rsp_data(u8 *len);

#ifdef BLE_PROFILE_DATA
//
// gatt profile include file, generated by jieli gatt_inc_generator.exe
//

static const uint8_t profile_data[] = {
    //////////////////////////////////////////////////////
    //
    // 0x0001 PRIMARY_SERVICE  1800
    //
    //////////////////////////////////////////////////////
    0x0a, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x28, 0x00, 0x18,

    /* CHARACTERISTIC,  2a00, READ | WRITE | DYNAMIC, */
    // 0x0002 CHARACTERISTIC 2a00 READ | WRITE | DYNAMIC
    0x0d, 0x00, 0x02, 0x00, 0x02, 0x00, 0x03, 0x28, 0x0a, 0x03, 0x00, 0x00, 0x2a,
    // 0x0003 VALUE 2a00 READ | WRITE | DYNAMIC
    0x08, 0x00, 0x0a, 0x01, 0x03, 0x00, 0x00, 0x2a,

    //////////////////////////////////////////////////////
    //
    // 0x0004 PRIMARY_SERVICE  ff00
    //
    //////////////////////////////////////////////////////
    0x0a, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x28, 0x00, 0xff,

    /* CHARACTERISTIC,  ff01, NOTIFY, */
    // 0x0005 CHARACTERISTIC ff01 NOTIFY
    0x0d, 0x00, 0x02, 0x00, 0x05, 0x00, 0x03, 0x28, 0x10, 0x06, 0x00, 0x01, 0xff,
    // 0x0006 VALUE ff01 NOTIFY
    0x08, 0x00, 0x10, 0x00, 0x06, 0x00, 0x01, 0xff,
    // 0x0007 CLIENT_CHARACTERISTIC_CONFIGURATION
    0x0a, 0x00, 0x0a, 0x01, 0x07, 0x00, 0x02, 0x29, 0x00, 0x00,

    /* CHARACTERISTIC,  ff02, WRITE | WRITE_WITHOUT_RESPONSE | DYNAMIC, */
    // 0x0008 CHARACTERISTIC ff02 WRITE | WRITE_WITHOUT_RESPONSE | DYNAMIC
    0x0d, 0x00, 0x02, 0x00, 0x08, 0x00, 0x03, 0x28, 0x0c, 0x09, 0x00, 0x02, 0xff,
    // 0x0009 VALUE ff02 WRITE | WRITE_WITHOUT_RESPONSE | DYNAMIC
    0x08, 0x00, 0x0c, 0x01, 0x09, 0x00, 0x02, 0xff,

    /* CHARACTERISTIC,  ff03, NOTIFY, */
    // 0x000a CHARACTERISTIC ff03 NOTIFY
    0x0d, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x03, 0x28, 0x10, 0x0b, 0x00, 0x03, 0xff,
    // 0x000b VALUE ff03 NOTIFY
    0x08, 0x00, 0x10, 0x00, 0x0b, 0x00, 0x03, 0xff,
    // 0x000c CLIENT_CHARACTERISTIC_CONFIGURATION
    0x0a, 0x00, 0x0a, 0x01, 0x0c, 0x00, 0x02, 0x29, 0x00, 0x00,

#if RCSP_BTMATE_EN
    //////////////////////////////////////////////////////
    //
    // 0x0004 PRIMARY_SERVICE  ae00
    //
    //////////////////////////////////////////////////////
    0x0a, 0x00, 0x02, 0x00, 0x80, 0x00, 0x00, 0x28, 0x00, 0xae,

    /* CHARACTERISTIC,  ae01, WRITE_WITHOUT_RESPONSE | DYNAMIC, */
    // 0x0040 CHARACTERISTIC ae01 WRITE_WITHOUT_RESPONSE | DYNAMIC
    0x0d, 0x00, 0x02, 0x00, 0x81, 0x00, 0x03, 0x28, 0x04, 0x82, 0x00, 0x01, 0xae,
    // 0x0041 VALUE ae01 WRITE_WITHOUT_RESPONSE | DYNAMIC
    0x08, 0x00, 0x04, 0x01, 0x82, 0x00, 0x01, 0xae,

    /* CHARACTERISTIC,  ae02, NOTIFY, */
    // 0x0042 CHARACTERISTIC ae02 NOTIFY
    0x0d, 0x00, 0x02, 0x00, 0x83, 0x00, 0x03, 0x28, 0x10, 0x84, 0x00, 0x02, 0xae,
    // 0x0043 VALUE ae02 NOTIFY
    0x08, 0x00, 0x10, 0x00, 0x84, 0x00, 0x02, 0xae,
    // 0x0044 CLIENT_CHARACTERISTIC_CONFIGURATION
    0x0a, 0x00, 0x0a, 0x01, 0x85, 0x00, 0x02, 0x29, 0x00, 0x00,
#endif

    // END
    0x00, 0x00,
};
//
// characteristics <--> handles
//
#define ATT_CHARACTERISTIC_2a00_01_VALUE_HANDLE 0x0003
#define ATT_CHARACTERISTIC_ff01_01_VALUE_HANDLE 0x0006
#define ATT_CHARACTERISTIC_ff01_01_CLIENT_CONFIGURATION_HANDLE 0x0007
#define ATT_CHARACTERISTIC_ff02_01_VALUE_HANDLE 0x0009
#define ATT_CHARACTERISTIC_ff03_01_VALUE_HANDLE 0x000b
#define ATT_CHARACTERISTIC_ff03_01_CLIENT_CONFIGURATION_HANDLE 0x000c


#if RCSP_BTMATE_EN
#define ATT_CHARACTERISTIC_ae01_02_VALUE_HANDLE 0x0082
#define ATT_CHARACTERISTIC_ae02_02_VALUE_HANDLE 0x0084
#define ATT_CHARACTERISTIC_ae02_02_CLIENT_CONFIGURATION_HANDLE 0x0085
#endif

#endif
#endif

#endif

